.class public Leu/erikw/PullToRefreshListView;
.super Landroid/widget/ListView;
.source "PullToRefreshListView.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Leu/erikw/PullToRefreshListView$HeaderAnimationListener;,
        Leu/erikw/PullToRefreshListView$OnRefreshListener;,
        Leu/erikw/PullToRefreshListView$PTROnGlobalLayoutListener;,
        Leu/erikw/PullToRefreshListView$PTROnItemClickListener;,
        Leu/erikw/PullToRefreshListView$State;
    }
.end annotation


# static fields
.field private static synthetic $SWITCH_TABLE$eu$erikw$PullToRefreshListView$State:[I = null

.field private static final BOUNCE_ANIMATION_DELAY:I = 0x64

.field private static final BOUNCE_ANIMATION_DURATION:I = 0x2bc

.field private static final BOUNCE_OVERSHOOT_TENSION:F = 1.4f

.field private static final PULL_RESISTANCE:F = 1.7f

.field private static final ROTATE_ARROW_ANIMATION_DURATION:I = 0xfa

.field private static measuredHeaderHeight:I


# instance fields
.field private bounceAnimation:Landroid/view/animation/TranslateAnimation;

.field private bounceBackHeader:Z

.field private flipAnimation:Landroid/view/animation/RotateAnimation;

.field private hasResetHeader:Z

.field private header:Landroid/widget/RelativeLayout;

.field private headerContainer:Landroid/widget/LinearLayout;

.field private headerPadding:I

.field private image:Landroid/widget/ImageView;

.field private lockScrollWhileRefreshing:Z

.field private onItemClickListener:Landroid/widget/AdapterView$OnItemClickListener;

.field private onRefreshListener:Leu/erikw/PullToRefreshListView$OnRefreshListener;

.field private previousY:F

.field private reverseFlipAnimation:Landroid/view/animation/RotateAnimation;

.field private scrollbarEnabled:Z

.field private spinner:Landroid/widget/ProgressBar;

.field private state:Leu/erikw/PullToRefreshListView$State;

.field private text:Landroid/widget/TextView;


# direct methods
.method static synthetic $SWITCH_TABLE$eu$erikw$PullToRefreshListView$State()[I
    .locals 3

    .prologue
    .line 44
    sget-object v0, Leu/erikw/PullToRefreshListView;->$SWITCH_TABLE$eu$erikw$PullToRefreshListView$State:[I

    if-eqz v0, :cond_0

    :goto_0
    return-object v0

    :cond_0
    invoke-static {}, Leu/erikw/PullToRefreshListView$State;->values()[Leu/erikw/PullToRefreshListView$State;

    move-result-object v0

    array-length v0, v0

    new-array v0, v0, [I

    :try_start_0
    sget-object v1, Leu/erikw/PullToRefreshListView$State;->PULL_TO_REFRESH:Leu/erikw/PullToRefreshListView$State;

    invoke-virtual {v1}, Leu/erikw/PullToRefreshListView$State;->ordinal()I

    move-result v1

    const/4 v2, 0x1

    aput v2, v0, v1
    :try_end_0
    .catch Ljava/lang/NoSuchFieldError; {:try_start_0 .. :try_end_0} :catch_2

    :goto_1
    :try_start_1
    sget-object v1, Leu/erikw/PullToRefreshListView$State;->REFRESHING:Leu/erikw/PullToRefreshListView$State;

    invoke-virtual {v1}, Leu/erikw/PullToRefreshListView$State;->ordinal()I

    move-result v1

    const/4 v2, 0x3

    aput v2, v0, v1
    :try_end_1
    .catch Ljava/lang/NoSuchFieldError; {:try_start_1 .. :try_end_1} :catch_1

    :goto_2
    :try_start_2
    sget-object v1, Leu/erikw/PullToRefreshListView$State;->RELEASE_TO_REFRESH:Leu/erikw/PullToRefreshListView$State;

    invoke-virtual {v1}, Leu/erikw/PullToRefreshListView$State;->ordinal()I

    move-result v1

    const/4 v2, 0x2

    aput v2, v0, v1
    :try_end_2
    .catch Ljava/lang/NoSuchFieldError; {:try_start_2 .. :try_end_2} :catch_0

    :goto_3
    sput-object v0, Leu/erikw/PullToRefreshListView;->$SWITCH_TABLE$eu$erikw$PullToRefreshListView$State:[I

    goto :goto_0

    :catch_0
    move-exception v1

    goto :goto_3

    :catch_1
    move-exception v1

    goto :goto_2

    :catch_2
    move-exception v1

    goto :goto_1
.end method

.method public constructor <init>(Landroid/content/Context;)V
    .locals 0
    .parameter "context"

    .prologue
    .line 94
    invoke-direct {p0, p1}, Landroid/widget/ListView;-><init>(Landroid/content/Context;)V

    .line 95
    invoke-direct {p0}, Leu/erikw/PullToRefreshListView;->init()V

    .line 96
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 0
    .parameter "context"
    .parameter "attrs"

    .prologue
    .line 99
    invoke-direct {p0, p1, p2}, Landroid/widget/ListView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 100
    invoke-direct {p0}, Leu/erikw/PullToRefreshListView;->init()V

    .line 101
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .locals 0
    .parameter "context"
    .parameter "attrs"
    .parameter "defStyle"

    .prologue
    .line 104
    invoke-direct {p0, p1, p2, p3}, Landroid/widget/ListView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 105
    invoke-direct {p0}, Leu/erikw/PullToRefreshListView;->init()V

    .line 106
    return-void
.end method

.method static synthetic access$0(Leu/erikw/PullToRefreshListView;)Leu/erikw/PullToRefreshListView$State;
    .locals 1
    .parameter

    .prologue
    .line 80
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->state:Leu/erikw/PullToRefreshListView$State;

    return-object v0
.end method

.method static synthetic access$1(Leu/erikw/PullToRefreshListView;)Landroid/widget/LinearLayout;
    .locals 1
    .parameter

    .prologue
    .line 81
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->headerContainer:Landroid/widget/LinearLayout;

    return-object v0
.end method

.method static synthetic access$10()I
    .locals 1

    .prologue
    .line 71
    sget v0, Leu/erikw/PullToRefreshListView;->measuredHeaderHeight:I

    return v0
.end method

.method static synthetic access$11(Leu/erikw/PullToRefreshListView;Z)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 78
    iput-boolean p1, p0, Leu/erikw/PullToRefreshListView;->hasResetHeader:Z

    return-void
.end method

.method static synthetic access$12(Leu/erikw/PullToRefreshListView;)Landroid/widget/AdapterView$OnItemClickListener;
    .locals 1
    .parameter

    .prologue
    .line 89
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->onItemClickListener:Landroid/widget/AdapterView$OnItemClickListener;

    return-object v0
.end method

.method static synthetic access$2(Leu/erikw/PullToRefreshListView;)Z
    .locals 1
    .parameter

    .prologue
    .line 75
    iget-boolean v0, p0, Leu/erikw/PullToRefreshListView;->scrollbarEnabled:Z

    return v0
.end method

.method static synthetic access$3(Leu/erikw/PullToRefreshListView;)Landroid/widget/RelativeLayout;
    .locals 1
    .parameter

    .prologue
    .line 82
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->header:Landroid/widget/RelativeLayout;

    return-object v0
.end method

.method static synthetic access$4(Leu/erikw/PullToRefreshListView;I)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 190
    invoke-direct {p0, p1}, Leu/erikw/PullToRefreshListView;->setHeaderPadding(I)V

    return-void
.end method

.method static synthetic access$5(Leu/erikw/PullToRefreshListView;)Z
    .locals 1
    .parameter

    .prologue
    .line 76
    iget-boolean v0, p0, Leu/erikw/PullToRefreshListView;->bounceBackHeader:Z

    return v0
.end method

.method static synthetic access$6(Leu/erikw/PullToRefreshListView;Z)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 76
    iput-boolean p1, p0, Leu/erikw/PullToRefreshListView;->bounceBackHeader:Z

    return-void
.end method

.method static synthetic access$7(Leu/erikw/PullToRefreshListView;)V
    .locals 0
    .parameter

    .prologue
    .line 259
    invoke-direct {p0}, Leu/erikw/PullToRefreshListView;->bounceBackHeader()V

    return-void
.end method

.method static synthetic access$8(Leu/erikw/PullToRefreshListView;Leu/erikw/PullToRefreshListView$State;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 298
    invoke-direct {p0, p1}, Leu/erikw/PullToRefreshListView;->setState(Leu/erikw/PullToRefreshListView$State;)V

    return-void
.end method

.method static synthetic access$9(I)V
    .locals 0
    .parameter

    .prologue
    .line 71
    sput p0, Leu/erikw/PullToRefreshListView;->measuredHeaderHeight:I

    return-void
.end method

.method private bounceBackHeader()V
    .locals 11

    .prologue
    const/4 v10, 0x1

    const/4 v2, 0x0

    const/4 v1, 0x0

    .line 260
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->state:Leu/erikw/PullToRefreshListView$State;

    sget-object v3, Leu/erikw/PullToRefreshListView$State;->REFRESHING:Leu/erikw/PullToRefreshListView$State;

    if-ne v0, v3, :cond_0

    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->headerContainer:Landroid/widget/LinearLayout;

    invoke-virtual {v0}, Landroid/widget/LinearLayout;->getHeight()I

    move-result v0

    iget-object v3, p0, Leu/erikw/PullToRefreshListView;->header:Landroid/widget/RelativeLayout;

    invoke-virtual {v3}, Landroid/widget/RelativeLayout;->getHeight()I

    move-result v3

    sub-int/2addr v0, v3

    neg-int v9, v0

    .line 262
    .local v9, yTranslate:I
    :goto_0
    new-instance v0, Landroid/view/animation/TranslateAnimation;

    .line 266
    int-to-float v8, v9

    move v3, v1

    move v4, v2

    move v5, v1

    move v6, v2

    move v7, v1

    invoke-direct/range {v0 .. v8}, Landroid/view/animation/TranslateAnimation;-><init>(IFIFIFIF)V

    .line 262
    iput-object v0, p0, Leu/erikw/PullToRefreshListView;->bounceAnimation:Landroid/view/animation/TranslateAnimation;

    .line 268
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->bounceAnimation:Landroid/view/animation/TranslateAnimation;

    const-wide/16 v2, 0x2bc

    invoke-virtual {v0, v2, v3}, Landroid/view/animation/TranslateAnimation;->setDuration(J)V

    .line 269
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->bounceAnimation:Landroid/view/animation/TranslateAnimation;

    invoke-virtual {v0, v10}, Landroid/view/animation/TranslateAnimation;->setFillEnabled(Z)V

    .line 270
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->bounceAnimation:Landroid/view/animation/TranslateAnimation;

    invoke-virtual {v0, v1}, Landroid/view/animation/TranslateAnimation;->setFillAfter(Z)V

    .line 271
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->bounceAnimation:Landroid/view/animation/TranslateAnimation;

    invoke-virtual {v0, v10}, Landroid/view/animation/TranslateAnimation;->setFillBefore(Z)V

    .line 272
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->bounceAnimation:Landroid/view/animation/TranslateAnimation;

    new-instance v1, Landroid/view/animation/OvershootInterpolator;

    const v2, 0x3fb33333

    invoke-direct {v1, v2}, Landroid/view/animation/OvershootInterpolator;-><init>(F)V

    invoke-virtual {v0, v1}, Landroid/view/animation/TranslateAnimation;->setInterpolator(Landroid/view/animation/Interpolator;)V

    .line 273
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->bounceAnimation:Landroid/view/animation/TranslateAnimation;

    new-instance v1, Leu/erikw/PullToRefreshListView$HeaderAnimationListener;

    const/4 v2, 0x0

    invoke-direct {v1, p0, v2}, Leu/erikw/PullToRefreshListView$HeaderAnimationListener;-><init>(Leu/erikw/PullToRefreshListView;Leu/erikw/PullToRefreshListView$HeaderAnimationListener;)V

    invoke-virtual {v0, v1}, Landroid/view/animation/TranslateAnimation;->setAnimationListener(Landroid/view/animation/Animation$AnimationListener;)V

    .line 275
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->bounceAnimation:Landroid/view/animation/TranslateAnimation;

    invoke-virtual {p0, v0}, Leu/erikw/PullToRefreshListView;->startAnimation(Landroid/view/animation/Animation;)V

    .line 276
    return-void

    .line 260
    .end local v9           #yTranslate:I
    :cond_0
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->headerContainer:Landroid/widget/LinearLayout;

    invoke-virtual {v0}, Landroid/widget/LinearLayout;->getHeight()I

    move-result v0

    neg-int v9, v0

    goto :goto_0
.end method

.method private init()V
    .locals 14

    .prologue
    const/4 v1, 0x0

    const/high16 v2, -0x3ccc

    const/4 v13, 0x0

    const/high16 v4, 0x3f00

    const/4 v3, 0x1

    .line 162
    const/4 v0, 0x0

    invoke-virtual {p0, v0}, Leu/erikw/PullToRefreshListView;->setVerticalFadingEdgeEnabled(Z)V

    .line 164
    invoke-virtual {p0}, Leu/erikw/PullToRefreshListView;->getContext()Landroid/content/Context;

    move-result-object v0

    invoke-static {v0}, Landroid/view/LayoutInflater;->from(Landroid/content/Context;)Landroid/view/LayoutInflater;

    move-result-object v0

    const v5, 0x7f030013

    invoke-virtual {v0, v5, v13}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/LinearLayout;

    iput-object v0, p0, Leu/erikw/PullToRefreshListView;->headerContainer:Landroid/widget/LinearLayout;

    .line 165
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->headerContainer:Landroid/widget/LinearLayout;

    const v5, 0x7f080031

    invoke-virtual {v0, v5}, Landroid/widget/LinearLayout;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/RelativeLayout;

    iput-object v0, p0, Leu/erikw/PullToRefreshListView;->header:Landroid/widget/RelativeLayout;

    .line 166
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->header:Landroid/widget/RelativeLayout;

    const v5, 0x7f080034

    invoke-virtual {v0, v5}, Landroid/widget/RelativeLayout;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    iput-object v0, p0, Leu/erikw/PullToRefreshListView;->text:Landroid/widget/TextView;

    .line 167
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->header:Landroid/widget/RelativeLayout;

    const v5, 0x7f080032

    invoke-virtual {v0, v5}, Landroid/widget/RelativeLayout;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/ImageView;

    iput-object v0, p0, Leu/erikw/PullToRefreshListView;->image:Landroid/widget/ImageView;

    .line 168
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->header:Landroid/widget/RelativeLayout;

    const v5, 0x7f080033

    invoke-virtual {v0, v5}, Landroid/widget/RelativeLayout;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/ProgressBar;

    iput-object v0, p0, Leu/erikw/PullToRefreshListView;->spinner:Landroid/widget/ProgressBar;

    .line 170
    new-instance v0, Landroid/view/animation/RotateAnimation;

    move v5, v3

    move v6, v4

    invoke-direct/range {v0 .. v6}, Landroid/view/animation/RotateAnimation;-><init>(FFIFIF)V

    iput-object v0, p0, Leu/erikw/PullToRefreshListView;->flipAnimation:Landroid/view/animation/RotateAnimation;

    .line 171
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->flipAnimation:Landroid/view/animation/RotateAnimation;

    new-instance v5, Landroid/view/animation/LinearInterpolator;

    invoke-direct {v5}, Landroid/view/animation/LinearInterpolator;-><init>()V

    invoke-virtual {v0, v5}, Landroid/view/animation/RotateAnimation;->setInterpolator(Landroid/view/animation/Interpolator;)V

    .line 172
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->flipAnimation:Landroid/view/animation/RotateAnimation;

    const-wide/16 v5, 0xfa

    invoke-virtual {v0, v5, v6}, Landroid/view/animation/RotateAnimation;->setDuration(J)V

    .line 173
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->flipAnimation:Landroid/view/animation/RotateAnimation;

    invoke-virtual {v0, v3}, Landroid/view/animation/RotateAnimation;->setFillAfter(Z)V

    .line 175
    new-instance v5, Landroid/view/animation/RotateAnimation;

    move v6, v2

    move v7, v1

    move v8, v3

    move v9, v4

    move v10, v3

    move v11, v4

    invoke-direct/range {v5 .. v11}, Landroid/view/animation/RotateAnimation;-><init>(FFIFIF)V

    iput-object v5, p0, Leu/erikw/PullToRefreshListView;->reverseFlipAnimation:Landroid/view/animation/RotateAnimation;

    .line 176
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->reverseFlipAnimation:Landroid/view/animation/RotateAnimation;

    new-instance v1, Landroid/view/animation/LinearInterpolator;

    invoke-direct {v1}, Landroid/view/animation/LinearInterpolator;-><init>()V

    invoke-virtual {v0, v1}, Landroid/view/animation/RotateAnimation;->setInterpolator(Landroid/view/animation/Interpolator;)V

    .line 177
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->reverseFlipAnimation:Landroid/view/animation/RotateAnimation;

    const-wide/16 v1, 0xfa

    invoke-virtual {v0, v1, v2}, Landroid/view/animation/RotateAnimation;->setDuration(J)V

    .line 178
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->reverseFlipAnimation:Landroid/view/animation/RotateAnimation;

    invoke-virtual {v0, v3}, Landroid/view/animation/RotateAnimation;->setFillAfter(Z)V

    .line 180
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->headerContainer:Landroid/widget/LinearLayout;

    invoke-virtual {p0, v0}, Leu/erikw/PullToRefreshListView;->addHeaderView(Landroid/view/View;)V

    .line 181
    sget-object v0, Leu/erikw/PullToRefreshListView$State;->PULL_TO_REFRESH:Leu/erikw/PullToRefreshListView$State;

    invoke-direct {p0, v0}, Leu/erikw/PullToRefreshListView;->setState(Leu/erikw/PullToRefreshListView$State;)V

    .line 182
    invoke-virtual {p0}, Leu/erikw/PullToRefreshListView;->isVerticalScrollBarEnabled()Z

    move-result v0

    iput-boolean v0, p0, Leu/erikw/PullToRefreshListView;->scrollbarEnabled:Z

    .line 184
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->header:Landroid/widget/RelativeLayout;

    invoke-virtual {v0}, Landroid/widget/RelativeLayout;->getViewTreeObserver()Landroid/view/ViewTreeObserver;

    move-result-object v12

    .line 185
    .local v12, vto:Landroid/view/ViewTreeObserver;
    new-instance v0, Leu/erikw/PullToRefreshListView$PTROnGlobalLayoutListener;

    invoke-direct {v0, p0, v13}, Leu/erikw/PullToRefreshListView$PTROnGlobalLayoutListener;-><init>(Leu/erikw/PullToRefreshListView;Leu/erikw/PullToRefreshListView$PTROnGlobalLayoutListener;)V

    invoke-virtual {v12, v0}, Landroid/view/ViewTreeObserver;->addOnGlobalLayoutListener(Landroid/view/ViewTreeObserver$OnGlobalLayoutListener;)V

    .line 187
    new-instance v0, Leu/erikw/PullToRefreshListView$PTROnItemClickListener;

    invoke-direct {v0, p0, v13}, Leu/erikw/PullToRefreshListView$PTROnItemClickListener;-><init>(Leu/erikw/PullToRefreshListView;Leu/erikw/PullToRefreshListView$PTROnItemClickListener;)V

    invoke-super {p0, v0}, Landroid/widget/ListView;->setOnItemClickListener(Landroid/widget/AdapterView$OnItemClickListener;)V

    .line 188
    return-void
.end method

.method private resetHeader()V
    .locals 2

    .prologue
    .line 279
    iget v0, p0, Leu/erikw/PullToRefreshListView;->headerPadding:I

    iget-object v1, p0, Leu/erikw/PullToRefreshListView;->header:Landroid/widget/RelativeLayout;

    invoke-virtual {v1}, Landroid/widget/RelativeLayout;->getHeight()I

    move-result v1

    neg-int v1, v1

    if-eq v0, v1, :cond_0

    invoke-virtual {p0}, Leu/erikw/PullToRefreshListView;->getFirstVisiblePosition()I

    move-result v0

    if-lez v0, :cond_1

    .line 280
    :cond_0
    sget-object v0, Leu/erikw/PullToRefreshListView$State;->PULL_TO_REFRESH:Leu/erikw/PullToRefreshListView$State;

    invoke-direct {p0, v0}, Leu/erikw/PullToRefreshListView;->setState(Leu/erikw/PullToRefreshListView$State;)V

    .line 289
    :goto_0
    return-void

    .line 284
    :cond_1
    invoke-virtual {p0}, Leu/erikw/PullToRefreshListView;->getAnimation()Landroid/view/animation/Animation;

    move-result-object v0

    if-eqz v0, :cond_2

    invoke-virtual {p0}, Leu/erikw/PullToRefreshListView;->getAnimation()Landroid/view/animation/Animation;

    move-result-object v0

    invoke-virtual {v0}, Landroid/view/animation/Animation;->hasEnded()Z

    move-result v0

    if-nez v0, :cond_2

    .line 285
    const/4 v0, 0x1

    iput-boolean v0, p0, Leu/erikw/PullToRefreshListView;->bounceBackHeader:Z

    goto :goto_0

    .line 287
    :cond_2
    invoke-direct {p0}, Leu/erikw/PullToRefreshListView;->bounceBackHeader()V

    goto :goto_0
.end method

.method private setHeaderPadding(I)V
    .locals 3
    .parameter "padding"

    .prologue
    const/4 v2, 0x0

    .line 191
    iput p1, p0, Leu/erikw/PullToRefreshListView;->headerPadding:I

    .line 193
    iget-object v1, p0, Leu/erikw/PullToRefreshListView;->header:Landroid/widget/RelativeLayout;

    invoke-virtual {v1}, Landroid/widget/RelativeLayout;->getLayoutParams()Landroid/view/ViewGroup$LayoutParams;

    move-result-object v0

    check-cast v0, Landroid/view/ViewGroup$MarginLayoutParams;

    .line 194
    .local v0, mlp:Landroid/view/ViewGroup$MarginLayoutParams;
    invoke-virtual {v0, v2, p1, v2, v2}, Landroid/view/ViewGroup$MarginLayoutParams;->setMargins(IIII)V

    .line 195
    iget-object v1, p0, Leu/erikw/PullToRefreshListView;->header:Landroid/widget/RelativeLayout;

    invoke-virtual {v1, v0}, Landroid/widget/RelativeLayout;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    .line 196
    return-void
.end method

.method private setState(Leu/erikw/PullToRefreshListView$State;)V
    .locals 4
    .parameter "state"

    .prologue
    const/4 v3, 0x4

    const/4 v2, 0x0

    .line 299
    iput-object p1, p0, Leu/erikw/PullToRefreshListView;->state:Leu/erikw/PullToRefreshListView$State;

    .line 300
    invoke-static {}, Leu/erikw/PullToRefreshListView;->$SWITCH_TABLE$eu$erikw$PullToRefreshListView$State()[I

    move-result-object v0

    invoke-virtual {p1}, Leu/erikw/PullToRefreshListView$State;->ordinal()I

    move-result v1

    aget v0, v0, v1

    packed-switch v0, :pswitch_data_0

    .line 324
    :goto_0
    return-void

    .line 302
    :pswitch_0
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->spinner:Landroid/widget/ProgressBar;

    invoke-virtual {v0, v3}, Landroid/widget/ProgressBar;->setVisibility(I)V

    .line 303
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->image:Landroid/widget/ImageView;

    invoke-virtual {v0, v2}, Landroid/widget/ImageView;->setVisibility(I)V

    .line 304
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->text:Landroid/widget/TextView;

    const v1, 0x7f070001

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setText(I)V

    goto :goto_0

    .line 308
    :pswitch_1
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->spinner:Landroid/widget/ProgressBar;

    invoke-virtual {v0, v3}, Landroid/widget/ProgressBar;->setVisibility(I)V

    .line 309
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->image:Landroid/widget/ImageView;

    invoke-virtual {v0, v2}, Landroid/widget/ImageView;->setVisibility(I)V

    .line 310
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->text:Landroid/widget/TextView;

    const v1, 0x7f070002

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setText(I)V

    goto :goto_0

    .line 314
    :pswitch_2
    invoke-direct {p0}, Leu/erikw/PullToRefreshListView;->setUiRefreshing()V

    .line 316
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->onRefreshListener:Leu/erikw/PullToRefreshListView$OnRefreshListener;

    if-nez v0, :cond_0

    .line 317
    sget-object v0, Leu/erikw/PullToRefreshListView$State;->PULL_TO_REFRESH:Leu/erikw/PullToRefreshListView$State;

    invoke-direct {p0, v0}, Leu/erikw/PullToRefreshListView;->setState(Leu/erikw/PullToRefreshListView$State;)V

    goto :goto_0

    .line 319
    :cond_0
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->onRefreshListener:Leu/erikw/PullToRefreshListView$OnRefreshListener;

    invoke-interface {v0}, Leu/erikw/PullToRefreshListView$OnRefreshListener;->onRefresh()V

    goto :goto_0

    .line 300
    nop

    :pswitch_data_0
    .packed-switch 0x1
        :pswitch_0
        :pswitch_1
        :pswitch_2
    .end packed-switch
.end method

.method private setUiRefreshing()V
    .locals 2

    .prologue
    .line 292
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->spinner:Landroid/widget/ProgressBar;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Landroid/widget/ProgressBar;->setVisibility(I)V

    .line 293
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->image:Landroid/widget/ImageView;

    invoke-virtual {v0}, Landroid/widget/ImageView;->clearAnimation()V

    .line 294
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->image:Landroid/widget/ImageView;

    const/4 v1, 0x4

    invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setVisibility(I)V

    .line 295
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->text:Landroid/widget/TextView;

    const v1, 0x7f070003

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setText(I)V

    .line 296
    return-void
.end method


# virtual methods
.method public isRefreshing()Z
    .locals 2

    .prologue
    .line 127
    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->state:Leu/erikw/PullToRefreshListView$State;

    sget-object v1, Leu/erikw/PullToRefreshListView$State;->REFRESHING:Leu/erikw/PullToRefreshListView$State;

    if-ne v0, v1, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public onRefreshComplete()V
    .locals 1

    .prologue
    .line 157
    sget-object v0, Leu/erikw/PullToRefreshListView$State;->PULL_TO_REFRESH:Leu/erikw/PullToRefreshListView$State;

    iput-object v0, p0, Leu/erikw/PullToRefreshListView;->state:Leu/erikw/PullToRefreshListView$State;

    .line 158
    invoke-direct {p0}, Leu/erikw/PullToRefreshListView;->resetHeader()V

    .line 159
    return-void
.end method

.method protected onScrollChanged(IIII)V
    .locals 2
    .parameter "l"
    .parameter "t"
    .parameter "oldl"
    .parameter "oldt"

    .prologue
    .line 328
    invoke-super {p0, p1, p2, p3, p4}, Landroid/widget/ListView;->onScrollChanged(IIII)V

    .line 330
    iget-boolean v0, p0, Leu/erikw/PullToRefreshListView;->hasResetHeader:Z

    if-nez v0, :cond_1

    .line 331
    sget v0, Leu/erikw/PullToRefreshListView;->measuredHeaderHeight:I

    if-lez v0, :cond_0

    iget-object v0, p0, Leu/erikw/PullToRefreshListView;->state:Leu/erikw/PullToRefreshListView$State;

    sget-object v1, Leu/erikw/PullToRefreshListView$State;->REFRESHING:Leu/erikw/PullToRefreshListView$State;

    if-eq v0, v1, :cond_0

    .line 332
    sget v0, Leu/erikw/PullToRefreshListView;->measuredHeaderHeight:I

    neg-int v0, v0

    invoke-direct {p0, v0}, Leu/erikw/PullToRefreshListView;->setHeaderPadding(I)V

    .line 335
    :cond_0
    const/4 v0, 0x1

    iput-boolean v0, p0, Leu/erikw/PullToRefreshListView;->hasResetHeader:Z

    .line 337
    :cond_1
    return-void
.end method

.method public onTouchEvent(Landroid/view/MotionEvent;)Z
    .locals 6
    .parameter "event"

    .prologue
    const/high16 v5, -0x4080

    .line 200
    iget-boolean v3, p0, Leu/erikw/PullToRefreshListView;->lockScrollWhileRefreshing:Z

    if-eqz v3, :cond_0

    iget-object v3, p0, Leu/erikw/PullToRefreshListView;->state:Leu/erikw/PullToRefreshListView$State;

    sget-object v4, Leu/erikw/PullToRefreshListView$State;->REFRESHING:Leu/erikw/PullToRefreshListView$State;

    if-ne v3, v4, :cond_0

    .line 201
    const/4 v3, 0x1

    .line 256
    :goto_0
    return v3

    .line 204
    :cond_0
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getAction()I

    move-result v3

    packed-switch v3, :pswitch_data_0

    .line 256
    :cond_1
    :goto_1
    invoke-super {p0, p1}, Landroid/widget/ListView;->onTouchEvent(Landroid/view/MotionEvent;)Z

    move-result v3

    goto :goto_0

    .line 206
    :pswitch_0
    invoke-virtual {p0}, Leu/erikw/PullToRefreshListView;->getFirstVisiblePosition()I

    move-result v3

    if-nez v3, :cond_2

    invoke-virtual {p1}, Landroid/view/MotionEvent;->getY()F

    move-result v3

    iput v3, p0, Leu/erikw/PullToRefreshListView;->previousY:F

    goto :goto_1

    .line 207
    :cond_2
    iput v5, p0, Leu/erikw/PullToRefreshListView;->previousY:F

    goto :goto_1

    .line 211
    :pswitch_1
    iget v3, p0, Leu/erikw/PullToRefreshListView;->previousY:F

    cmpl-float v3, v3, v5

    if-eqz v3, :cond_1

    iget-object v3, p0, Leu/erikw/PullToRefreshListView;->state:Leu/erikw/PullToRefreshListView$State;

    sget-object v4, Leu/erikw/PullToRefreshListView$State;->RELEASE_TO_REFRESH:Leu/erikw/PullToRefreshListView$State;

    if-eq v3, v4, :cond_3

    invoke-virtual {p0}, Leu/erikw/PullToRefreshListView;->getFirstVisiblePosition()I

    move-result v3

    if-nez v3, :cond_1

    .line 212
    :cond_3
    invoke-static {}, Leu/erikw/PullToRefreshListView;->$SWITCH_TABLE$eu$erikw$PullToRefreshListView$State()[I

    move-result-object v3

    iget-object v4, p0, Leu/erikw/PullToRefreshListView;->state:Leu/erikw/PullToRefreshListView$State;

    invoke-virtual {v4}, Leu/erikw/PullToRefreshListView$State;->ordinal()I

    move-result v4

    aget v3, v3, v4

    packed-switch v3, :pswitch_data_1

    goto :goto_1

    .line 220
    :pswitch_2
    invoke-direct {p0}, Leu/erikw/PullToRefreshListView;->resetHeader()V

    goto :goto_1

    .line 214
    :pswitch_3
    sget-object v3, Leu/erikw/PullToRefreshListView$State;->REFRESHING:Leu/erikw/PullToRefreshListView$State;

    invoke-direct {p0, v3}, Leu/erikw/PullToRefreshListView;->setState(Leu/erikw/PullToRefreshListView$State;)V

    .line 215
    invoke-direct {p0}, Leu/erikw/PullToRefreshListView;->bounceBackHeader()V

    goto :goto_1

    .line 227
    :pswitch_4
    iget v3, p0, Leu/erikw/PullToRefreshListView;->previousY:F

    cmpl-float v3, v3, v5

    if-eqz v3, :cond_1

    .line 228
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getY()F

    move-result v2

    .line 229
    .local v2, y:F
    iget v3, p0, Leu/erikw/PullToRefreshListView;->previousY:F

    sub-float v0, v2, v3

    .line 230
    .local v0, diff:F
    const/4 v3, 0x0

    cmpl-float v3, v0, v3

    if-lez v3, :cond_4

    const v3, 0x3fd9999a

    div-float/2addr v0, v3

    .line 231
    :cond_4
    iput v2, p0, Leu/erikw/PullToRefreshListView;->previousY:F

    .line 233
    iget v3, p0, Leu/erikw/PullToRefreshListView;->headerPadding:I

    invoke-static {v0}, Ljava/lang/Math;->round(F)I

    move-result v4

    add-int/2addr v3, v4

    iget-object v4, p0, Leu/erikw/PullToRefreshListView;->header:Landroid/widget/RelativeLayout;

    invoke-virtual {v4}, Landroid/widget/RelativeLayout;->getHeight()I

    move-result v4

    neg-int v4, v4

    invoke-static {v3, v4}, Ljava/lang/Math;->max(II)I

    move-result v1

    .line 234
    .local v1, newHeaderPadding:I
    iget-boolean v3, p0, Leu/erikw/PullToRefreshListView;->lockScrollWhileRefreshing:Z

    if-nez v3, :cond_5

    iget-object v3, p0, Leu/erikw/PullToRefreshListView;->state:Leu/erikw/PullToRefreshListView$State;

    sget-object v4, Leu/erikw/PullToRefreshListView$State;->REFRESHING:Leu/erikw/PullToRefreshListView$State;

    if-ne v3, v4, :cond_5

    if-lez v1, :cond_5

    .line 235
    const/4 v1, 0x0

    .line 238
    :cond_5
    invoke-direct {p0, v1}, Leu/erikw/PullToRefreshListView;->setHeaderPadding(I)V

    .line 240
    iget-object v3, p0, Leu/erikw/PullToRefreshListView;->state:Leu/erikw/PullToRefreshListView$State;

    sget-object v4, Leu/erikw/PullToRefreshListView$State;->PULL_TO_REFRESH:Leu/erikw/PullToRefreshListView$State;

    if-ne v3, v4, :cond_6

    iget v3, p0, Leu/erikw/PullToRefreshListView;->headerPadding:I

    if-lez v3, :cond_6

    .line 241
    sget-object v3, Leu/erikw/PullToRefreshListView$State;->RELEASE_TO_REFRESH:Leu/erikw/PullToRefreshListView$State;

    invoke-direct {p0, v3}, Leu/erikw/PullToRefreshListView;->setState(Leu/erikw/PullToRefreshListView$State;)V

    .line 243
    iget-object v3, p0, Leu/erikw/PullToRefreshListView;->image:Landroid/widget/ImageView;

    invoke-virtual {v3}, Landroid/widget/ImageView;->clearAnimation()V

    .line 244
    iget-object v3, p0, Leu/erikw/PullToRefreshListView;->image:Landroid/widget/ImageView;

    iget-object v4, p0, Leu/erikw/PullToRefreshListView;->flipAnimation:Landroid/view/animation/RotateAnimation;

    invoke-virtual {v3, v4}, Landroid/widget/ImageView;->startAnimation(Landroid/view/animation/Animation;)V

    goto/16 :goto_1

    .line 245
    :cond_6
    iget-object v3, p0, Leu/erikw/PullToRefreshListView;->state:Leu/erikw/PullToRefreshListView$State;

    sget-object v4, Leu/erikw/PullToRefreshListView$State;->RELEASE_TO_REFRESH:Leu/erikw/PullToRefreshListView$State;

    if-ne v3, v4, :cond_1

    iget v3, p0, Leu/erikw/PullToRefreshListView;->headerPadding:I

    if-gez v3, :cond_1

    .line 246
    sget-object v3, Leu/erikw/PullToRefreshListView$State;->PULL_TO_REFRESH:Leu/erikw/PullToRefreshListView$State;

    invoke-direct {p0, v3}, Leu/erikw/PullToRefreshListView;->setState(Leu/erikw/PullToRefreshListView$State;)V

    .line 248
    iget-object v3, p0, Leu/erikw/PullToRefreshListView;->image:Landroid/widget/ImageView;

    invoke-virtual {v3}, Landroid/widget/ImageView;->clearAnimation()V

    .line 249
    iget-object v3, p0, Leu/erikw/PullToRefreshListView;->image:Landroid/widget/ImageView;

    iget-object v4, p0, Leu/erikw/PullToRefreshListView;->reverseFlipAnimation:Landroid/view/animation/RotateAnimation;

    invoke-virtual {v3, v4}, Landroid/widget/ImageView;->startAnimation(Landroid/view/animation/Animation;)V

    goto/16 :goto_1

    .line 204
    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_0
        :pswitch_1
        :pswitch_4
    .end packed-switch

    .line 212
    :pswitch_data_1
    .packed-switch 0x1
        :pswitch_2
        :pswitch_3
    .end packed-switch
.end method

.method public setLockScrollWhileRefreshing(Z)V
    .locals 0
    .parameter "lockScrollWhileRefreshing"

    .prologue
    .line 137
    iput-boolean p1, p0, Leu/erikw/PullToRefreshListView;->lockScrollWhileRefreshing:Z

    .line 138
    return-void
.end method

.method public setOnItemClickListener(Landroid/widget/AdapterView$OnItemClickListener;)V
    .locals 0
    .parameter

    .prologue
    .line 110
    .local p1, onItemClickListener:Landroid/widget/AdapterView$OnItemClickListener;,"Landroid/widget/AdapterView$OnItemClickListener;"
    iput-object p1, p0, Leu/erikw/PullToRefreshListView;->onItemClickListener:Landroid/widget/AdapterView$OnItemClickListener;

    .line 111
    return-void
.end method

.method public setOnRefreshListener(Leu/erikw/PullToRefreshListView$OnRefreshListener;)V
    .locals 0
    .parameter "onRefreshListener"

    .prologue
    .line 120
    iput-object p1, p0, Leu/erikw/PullToRefreshListView;->onRefreshListener:Leu/erikw/PullToRefreshListView$OnRefreshListener;

    .line 121
    return-void
.end method

.method public setRefreshing()V
    .locals 2

    .prologue
    const/4 v1, 0x0

    .line 146
    sget-object v0, Leu/erikw/PullToRefreshListView$State;->REFRESHING:Leu/erikw/PullToRefreshListView$State;

    iput-object v0, p0, Leu/erikw/PullToRefreshListView;->state:Leu/erikw/PullToRefreshListView$State;

    .line 147
    invoke-virtual {p0, v1, v1}, Leu/erikw/PullToRefreshListView;->scrollTo(II)V

    .line 148
    invoke-direct {p0}, Leu/erikw/PullToRefreshListView;->setUiRefreshing()V

    .line 149
    invoke-direct {p0, v1}, Leu/erikw/PullToRefreshListView;->setHeaderPadding(I)V

    .line 150
    return-void
.end method
